

#!/usr/bin/perl

sub unescape
{
    $_ = $_[0];
    local (%t) = ("0", 0, "1", 1, "2", 2, "3", 3, "4", 4,
		  "5", 5, "6", 6, "7", 7, "8", 8, "9", 9,
		  "A",10, "B",11, "C",12, "D",13, "E",14, "F",15);
    s/\+/ /g;
    s/%([0123456789ABCDEF])([0123456789ABCDEF])/sprintf("%c", 16 * $t{$1} + $t{$2})/ge;
    $_;
}


read (STDIN, $indata, $ENV{CONTENT_LENGTH});
@in_data = split ('&', $indata);

for (@in_data)
{ 
    if (/^([^=]+)=(.*)/)
    {
	eval "\$$1 = \"" . &unescape ("$2") . "\";";
    }
}

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
@z = ('00' .. '59');
@m = ('01' .. '12'); 
@mm = ('1' .. '12'); 
$year += 1900;
$now = "$year/@m[$mon]/@z[$mday]-@z[$hour]:@z[$min]";
$heute = "$mday. @mm[$mon]. $year" ;


open (M, "| Mail -s 'etoy www request' comm");
print M "
Company = $Company
Name = $Name
E-mail = $Email
Telephone = $Telephon
Fax = $Fax
Address = $Adresse
Singleroom = $Singleroom
Doubleroom = $Doubleroom
Tripleroom = $Tripleroom
Arrival-Day = $ADay
Arrival-Month = $AMonth
Arrival-Year = $AYear
Departure-Day = $DDay
Departure-Month = $DMonth
Departure-Year = $DYear
Payment = $payment
CardType = $cardType
CardNumber = $cardNumber
CardExpire = $cardExpire
Comments = $comments
";
close M;

# Antwort an Besteller


print "Content-type: text/html\012\012";
print "<HTML>\n<HEAD><TITLE>Confirmation</TITLE\n";
print "<BODY>\n";


print "<H1>Confirmation</H1>\n"; 

print "<h2>Vienna, $heute</h2>\n<hr>\n";

print "Thank you for ... etoy!<br>Your request
has been mailed to etoy and will be processed as soon as possible.<br>
You will get a confirmation of your terms after we have checked whether the
rooms are available.<br>\n";

print '<a href="/etoy/">--OK--</a>';

print "</body>\n";


